/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.rcn.core;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;


/**
 *
 * @author Nicolas
 */
@Entity
@Table (name="patient")
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
public class Patient extends Person implements Serializable{
    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private long id;
    private String address;
    private int idNumber;
    private Date birthDate;
    private String telephone;
    private String notes;
    
    public Patient()
    {}
    
    /**
     * @return the address
     */
    @Basic
    @Column(name = "address")
    public String getAddress() {
        return address;
    }

    /**
     * @param address the address to set
     */
    public void setAddress(String address) {
        this.address = address;
    }

    /**
     * @return the fechaNacimiento
     */
    @Basic
    @Column(name = "birthDate")
    @Temporal(TemporalType.DATE)
    public Date getBirthDate() {
        return birthDate;
    }

    /**
     * @param birthDate the birthDate to set
     */
    public void setBirthDate(Date birthDate) {
        this.birthDate = birthDate;
    }

    /**
     * @return the idNumber
     */
    @Basic
    @Column(name = "idNumber")
    public int getIdNumber() {
        return idNumber;
    }

    /**
     * @param idNumber the idNumber to set
     */
    public void setIdNumber(int idNumber) {
        this.idNumber=idNumber;
    }

    /**
     * @return the id
     */
    @GeneratedValue(strategy=GenerationType.AUTO)
    @Column(name = "id")
    @Id
    public long getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(long id) {
        this.id = id;
    }
    
    /**
     * @return the telephone
     */
    @Basic
    @Column(name = "telephone")
    public String getTelephone() {
        return telephone;
    }

    /**
     * @param telephone the telephone to set
     */
    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }   
    
    @Basic
    @Column(name = "notes")
	public String getNotes() {
		return notes;
	}

	public void setNotes(String notes) {
		this.notes = notes;
	}
	
    @Override
    public boolean equals(Object patient){
        if(patient instanceof Patient){
            if(((Patient)patient).getId()==this.getId()){
                return true;
            }
        }
        return false;
    }
}
